#include <linux/string.h>

int __strncpy(char *dst, const char *src, unsigned int size)
{
    int cnt = 0;

    if (dst && src && size)
    {
        for (int i = 0; i < size; i++)
        {
            dst[i] = src[i];
            if (src[i] == '\0')
                break;

            cnt++;
        }

        if (cnt == size)
        {
            cnt --;
            dst[cnt] = 0;
        }
    }

    return cnt;
}
